class Admin::BaseAdminController < ApplicationController
  layout "admin"
  
  before_filter :authorize
  
  @@PER_PAGE = 10
  
  private
  def authorize
    @user = User.find_by_id(session[:user_id])
    unless @user
      session[:original_uri] = request.request_uri
      flash[:notice] = "Please log in"
      redirect_to(:controller => "/user", :action => "login")
      # prevent the next filter in filter chain from executing
      return false
    else
      @blog = @user.blog
    end
  end
end
